Skip to content

[Repo Assist] test: add direct unit tests for XmlDoc module (+32 tests, 357→389)#422

Merged
sergey-tihon merged 4 commits into
masterfrom
repo-assist/test-xmldoc-unit-tests-20260504-03e2c086bc0d7503
May 4, 2026
Merged

[Repo Assist] test: add direct unit tests for XmlDoc module (+32 tests, 357→389)#422
sergey-tihon merged 4 commits into
masterfrom
repo-assist/test-xmldoc-unit-tests-20260504-03e2c086bc0d7503

Conversation

@github-actions

@github-actions github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

The XmlDoc helper module (XmlDoc.buildEnumDoc, combineDescAndEnum, buildXmlDoc) was exercised only indirectly through full-schema compilation tests. This PR adds 32 new tests that target these pure functions directly, making regressions faster to detect and easier to diagnose.

New test modules added to UtilsTests.fs

Module Tests
BuildEnumDocTests null list, empty list, single value, multiple values, null node
CombineDescAndEnumTests all four (null/value) × (None/Some) combinations
BuildXmlDocTests summary, remarks (present/absent when description = summary), param tags, returns tag, XML escaping of & < >

New integration tests added to Schema.XmlDocTests.fs

  • <remarks> tag is generated when operation description differs from summary
  • No <remarks> tag when description equals summary (deduplication)
  • XML escaping: &, <, > in summary/description produce &, <, >
  • Request body description field surfaces as a <param> tag in the method XmlDoc
  • A 201 Created response description surfaces as a <returns> tag

Test Status

Build: ✅ 0 errors, 12 pre-existing warnings (all unrelated to these changes)
Tests: ✅ 389 passed, 0 failed, 1 skipped (pre-existing skip) — up from 357
Format: ✅ Fantomas check passes

SwaggerProvider.Tests  Total: 389, Errors: 0, Failed: 0, Skipped: 1, Time: 0.942s

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@3de4e604a36b5190a1c7dc4719c7341500ba8a95

Add dedicated unit tests for the XmlDoc helper functions that were
previously only exercised indirectly via full-schema compilation tests.

New test modules in UtilsTests.fs:
- BuildEnumDocTests: null/empty/single/multiple enum values, null node
- CombineDescAndEnumTests: all four (null/value) × (None/Some) combinations
- BuildXmlDocTests: summary, remarks (present/absent), param tags, returns
  tag, and XML escaping of & < > in summary and description

New integration tests in Schema.XmlDocTests.fs:
- <remarks> tag when description differs from summary
- No <remarks> when description equals summary
- XML escaping for & < > in generated method XmlDoc
- Request body description surfaced as <param> tag
- 201 Created response description surfaced as <returns> tag

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sergey-tihon sergey-tihon marked this pull request as ready for review May 4, 2026 13:42
Copilot AI review requested due to automatic review settings May 4, 2026 13:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds direct and integration-level unit tests around the SwaggerProvider.Internal.XmlDoc helper functions so XmlDoc behavior (enum rendering, description+enum merging, summary/remarks/param/returns formatting, and XML escaping) is validated without relying solely on full-schema compilation tests.

Changes:

  • Added direct unit tests for XmlDoc.buildEnumDoc, XmlDoc.combineDescAndEnum, and XmlDoc.buildXmlDoc.
  • Added integration tests asserting <remarks> generation/deduplication, XML escaping, request body description → <param>, and 201 response description → <returns>.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
tests/SwaggerProvider.Tests/UtilsTests.fs Adds direct unit tests for XmlDoc helper functions (enum doc, combining description + enum doc, and XML doc tag builder).
tests/SwaggerProvider.Tests/Schema.XmlDocTests.fs Adds schema-compilation integration tests to verify produced method XmlDoc includes remarks, escaping, request body param docs, and 201 return docs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/SwaggerProvider.Tests/UtilsTests.fs Outdated
Comment thread tests/SwaggerProvider.Tests/UtilsTests.fs Outdated
Comment thread tests/SwaggerProvider.Tests/Schema.XmlDocTests.fs
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@sergey-tihon

Copy link
Copy Markdown
Member

@copilot fix formating and build

Copilot AI commented May 4, 2026

Copy link
Copy Markdown
Contributor

@copilot fix formating and build

Fixed in commit 8cf921d. Schema.XmlDocTests.fs needed Fantomas formatting applied to a multi-line Regex.IsMatch call — CI's CheckFormat step now passes and all 389 tests pass.

Copilot AI requested a review from sergey-tihon May 4, 2026 13:53
@sergey-tihon sergey-tihon merged commit 560dc6a into master May 4, 2026
2 checks passed
@sergey-tihon sergey-tihon deleted the repo-assist/test-xmldoc-unit-tests-20260504-03e2c086bc0d7503 branch May 4, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants